<template>
  <div class="myBox">
    <div class="L"><img :src="business.avatar_text" /></div>
    <div class="C">
      <div class="tit">{{ business.nickname }}</div>
      <div class="sub">{{ business.mobile }}</div>
    </div>
  </div>

  <div class="allkbox"></div>

  <div class="myboxcon">
    <router-link to="/business/profile">
      <p>基本资料</p>
      <img src="/assets/images/go.png">
    </router-link>
    
  </div>
  <div class="myboxcon" v-if="business.auth == '0'">
    <router-link to="/business/email">
      <p>邮箱认证</p>
      <img src="/assets/images/go.png">
    </router-link>
    
  </div>
  <div class="myboxcon">
    <router-link to="/address/index">
      <p>我的收货地址</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/order/index">
      <p>我的订单</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/record/index">
      <p>消费记录</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon">
    <router-link to="/business/pay">
      <p>充值</p>
      <img src="/assets/images/go.png">
    </router-link>
  </div>
  <div class="myboxcon" @click="out">
    <p>退出</p>
    <img src="/assets/images/go.png">
  </div>

  <tabbar />
</template>

<script setup>
import tabbar from '@/components/tabbar.vue'

//获取this对象 === 代理对象
const { proxy } = getCurrentInstance()

let business = proxy.$cookies.get('business') ? proxy.$cookies.get('business') : {}
business = ref(business)

// console.log(business)

const out = () => {
  proxy.$confirm({
    title: '退出提醒',
    message: '是否确认退出当前账号？',
  })
    //确认操作
    .then(() => {
      //弹幕提示
      proxy.$success('退出成功')

      proxy.$cookies.remove('business');
      
      proxy.$router.push('/business/login')

      return false
    })
    //取消操作
    .catch(() => { })
}

</script>